 // Limits the textarea field
 function textCounter (field, countfield, maxlimit) 
 {

 if (field.value.length > maxlimit)
	field.value = field.value.substring(0, maxlimit);
 else 
	countfield.value = maxlimit - field.value.length;
 }

 // Opens the page in a new window
 function windowOpen (mypage, w, h)

 {

  	if(screen.width)

  	{

  		var winl = (screen.width-w)/2;
  		var wint = (screen.height-h)/2;

  	}

  	else

  	{

  		winl = 0;wint =0;

  	}

  	if (winl < 0) winl = 0;
  	if (wint < 0) wint = 0;

  	var settings = 'height=' + h + ',';
  	settings += 'width=' + w + ',';
  	settings += 'top=' + wint + ',';
  	settings += 'left=' + winl + ',';
  	settings += ' scrollbars=yes ';

	var myname = '';

  	win = window.open(mypage,myname,settings);

  	win.window.focus();

 }

 function confirmDelete(msg) {
  if (!msg) {msg="Are you sure?"}

  var agree=confirm(msg);
  if (agree)
   return true ;
  else
   return false ;
 }
 
function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}